package com.yidu.ladder.delivery.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.ladder.base.domain.RipareaStaffVo;
import com.yidu.ladder.base.domain.StaffVo;
import com.yidu.ladder.delivery.domain.Workorder;
import com.yidu.ladder.delivery.domain.WorkorderVo;
import com.yidu.ladder.delivery.service.WorkorderService;

@Controller
@RequestMapping("/delivery/")
public class WorkorderController {
	@Autowired
	private WorkorderService workorderService;

	public WorkorderService getWorkorderService() {
		return workorderService;
	}

	public void setWorkorderService(WorkorderService workorderService) {
		this.workorderService = workorderService;
	}

	public WorkorderController(WorkorderService workorderService) {
		super();
		this.workorderService = workorderService;
	}

	public WorkorderController() {
		super();
	}

	/**
	 * 检索
	 * 
	 * @param WorkorderVo 包装类
	 * @return 信息数据
	 */
	@ResponseBody
	@RequestMapping(value = "Workorders")
	public Map<String, Object> Workorder(WorkorderVo workorderVo) {
		Map<String, Object> userMap =workorderService.pageQueryWorkorder(workorderVo);
		return userMap;
	}
	/**
	 * 检索
	 * 
	 * @param WorkorderVo 包装类
	 * @return 信息数据
	 */
	@ResponseBody
	@RequestMapping(value = "Staffs")
	public Map<String, Object> pageStaff(StaffVo staffVo) {
		Map<String, Object> userMap =workorderService.pageQuerStaff(staffVo);
		return userMap;
	}
	/**
	 * 检索
	 * 
	 * @param WorkorderVo 包装类
	 * @return 信息数据
	 */
	@ResponseBody
	@RequestMapping(value = "RipareaStaffs")
	public Map<String, Object> RipareaStaff(RipareaStaffVo ripareaStaffVo) {
		Map<String, Object> userMap =workorderService.pgaeQuerStaffs(ripareaStaffVo);
		return userMap;
	}
	/***
	 * 修改数据
	 * 
	 * @param archives
	 * @return
	 */
	@RequestMapping(value = "updateworkorder", method = RequestMethod.POST)
	@ResponseBody
	public int updateStaff(Workorder workorder) {
			int dd = workorderService.updateworkorder(workorder);
			return dd;
	}
	
	@GetMapping("workOrder")
	@ResponseBody
	public Map<String, Object> findWorkorderByBNoId(String businessNoticeId){
		List<Workorder> workList = workorderService.findWorkorderByBNoId(businessNoticeId);
		//计数
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", 0);
		map.put("msg", "");
		map.put("count", 1);
		map.put("data", workList);
		return map;
	}
}
